import Cookies from 'js-cookie'

const TokenKey = 'DIANCAN_TOKEN'
const UserInfo = 'USERINFO'

// 获取凭证
export function getToken() {
    return Cookies.get(TokenKey)
}

export function getUserInfo() {
    return Cookies.get(UserInfo)
}

// 存储凭证
export function setToken(token) {
    return Cookies.set(TokenKey, token)
}

//存储用户信息
export function setUserInfo(userInfo) {
    return Cookies.set(UserInfo, JSON.stringify(userInfo))
}

// 删除凭证
export function removeToken() {
    return Cookies.remove(TokenKey)
}

export function removeUserInfo() {
    return Cookies.remove(UserInfo)
}
